package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppZdDept;

@Mapper
public interface AppZdDeptDao {

    @Select("select * from app_zd_dept t where t.id = #{id}")
    AppZdDept getById(Long id);

    @Delete("delete from app_zd_dept where id = #{id}")
    int delete(Long id);

    int update(AppZdDept appZdDept);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_zd_dept(deptid, hostcode, code, name, pcode, remark, descs, address) values(#{deptid}, #{hostcode}, #{code}, #{name}, #{pcode}, #{remark}, #{descs}, #{address})")
    int save(AppZdDept appZdDept);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppZdDept> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);



    @Select("select * from app_zd_dept t where t.hostcode = #{hostcode}")
    List<AppZdDept> getBylist(String hostcode);
}
